package com.esri.core.tasks.ags.geoprocessing;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;
import org.codehaus.jackson.map.ObjectMapper;

/* loaded from: classes.dex */
public class GPString extends GPParameter {
    private static final long serialVersionUID = 1;
    private String value;

    public GPString(String str) {
        setParamName(str);
        this.dataType = "GPString";
    }

    public GPString() {
        this("");
    }

    public String getValue() {
        return this.value;
    }

    public void setValue(String str) {
        this.value = str;
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public String generateValueParams() {
        return this.value;
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public void fromJson(JsonParser jsonParser) throws Exception {
        JsonToken currentToken = jsonParser.getCurrentToken();
        if (currentToken != null && currentToken == JsonToken.VALUE_STRING) {
            if (jsonParser.getCodec() != null) {
                this.value = jsonParser.readValueAsTree().asText();
                return;
            } else {
                this.value = jsonParser.getText();
                return;
            }
        }
        JsonNode readTree = new ObjectMapper().readTree(jsonParser);
        this.value = readTree != null ? readTree.toString() : null;
    }

    public int hashCode() {
        String str = this.value;
        return 31 + (str == null ? 0 : str.hashCode());
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            GPString gPString = (GPString) obj;
            String str = this.value;
            if (str == null) {
                if (gPString.value != null) {
                    return false;
                }
            } else if (!str.equals(gPString.value)) {
                return false;
            }
            return true;
        }
        return false;
    }

    public String toString() {
        return this.value;
    }
}
